package com.morehair.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 * Date: 2021/6/10
 * Time: 11:17
 * author: zhang wei
 */

public class StringOfGoodsUtil {
    public static List<String> stringToList(String preStr) {
        List<String> list = new ArrayList<>();
        if (preStr.length() > 4) {
            //先去掉两边的[]，然后将之用 逗号空格 分开
            String[] strArr = preStr.substring(1, preStr.length() - 1).split(", ");
            // 数组转化为List
            for (String str : strArr) {
                list.add(str.substring(1, str.length() - 1));
            }
        }
        return list;
    }
}
